import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store =  new Vuex.Store({
  state: {
    public_backShow: false, //公共遮挡层
    productList: [], //产品列表
    targetList: [], //指标列表
    dataSourceList: [], //问题来源列表
    proposalList: [], //问题分裂列表
    createQuestionOpen: false, //新增问题版块右边弹窗判断
    protitle: '', //首页选择的产品
    showRichText:false, //富文本框(右侧单独只有一个富文本框)显示
    showNewEight:false, //新增8D
    showJointly:false, //会签版块显示
    showAddMember: false, //D1新增成员显示
    showChangeBool:false, //D8修改工厂状态显示
    showChooseFactory:false, //D8添加工厂显示
    showchooseTabs:false, //D8添加标签显示
    showUpstatePro:false, //修改功能弹窗显示
    publicHaveNode: 0, //当前已开通的8D节点
    publicNowNode: 0, //当前8D节点
    showWorkDay: false, //工作日版块显示
    showMainTainPlant: false, //供应商信息版块显示
    publicD4Par: [], //D4的供应商数据
  },
  getters: { // 暴露值到外部
    public_backShow : state => state.public_backShow,
    productList : state => state.productList,
    targetList : state => state.targetList,
    dataSourceList : state => state.dataSourceList,
    proposalList : state => state.proposalList,
    createQuestionOpen : state => state.createQuestionOpen,
    showRichText : state => state.showRichText,
    showNewEight : state => state.showNewEight,
    showJointly : state => state.showJointly,
    showAddMember : state => state.showAddMember,
    showChangeBool : state => state.showChangeBool,
    showChooseFactory : state => state.showChooseFactory,
    showchooseTabs : state => state.showchooseTabs,
    protitle : state => state.protitle,
    showUpstatePro : state => state.showUpstatePro,
    publicHaveNode : state => state.publicHaveNode,
    publicNowNode : state => state.publicNowNode,
    showWorkDay : state => state.showWorkDay,
    showMainTainPlant : state => state.showMainTainPlant,
    publicD4Par : state => state.publicD4Par,
  },
  actions: {
    upstate({commit},keyval){
      commit('UPSTATE',keyval)
    },
    upPush({commit},keyval){
      commit('UPPUSH',keyval)
    },
  },
  mutations: {
    //修改功能
    UPSTATE(state,keyval){
      state[keyval.key] = keyval.val
    },
    //数组添加功能
    UPPUSH(state,keyval){
      state[keyval.key].push(keyval.val)
    },
  },
})
export default store
